package permutation;

public class stringbasedonindex {

	public static void main(String[] args) {

		stringbasedonindex t = new stringbasedonindex();

		String orgarray[] = { "sameer", "saleel", "sachin" };
		//int arr1[] = t.createIndexArray(orgarray);
		int arr1[]={2,0,1};
		
		t.method(orgarray, arr1);

	}

	 int[] createIndexArray(String[] orgarray) {

		int arr1[] = new int[orgarray.length];
		for (int i = 0; i < orgarray.length; i++) {

			arr1[i] = i;

		}

		return arr1;
	}

	String[] method(String orgarray[], int iarr[]) {

		String [] orgarray_mod=new String[orgarray.length];
		for (int i = 0, j = 0; i < orgarray.length & j < iarr.length; i++, j++) {
			orgarray_mod[i] = orgarray[iarr[j]];

			System.out.print(orgarray_mod[i]+ " ");
		}
		System.out.println();
		return orgarray_mod;

	}

}
